﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NakovBlog
{
    public class ComentDTO
    {
        public int ComentId { get; set; }
        public string ComentText { get; set; }
        public int BlogId { get; set; }
        public string Author { get; set; }
        public string Postdate { get; set; }

        public static ComentDTO ConverFromComent(Coment comentFromDb)
        {
            ComentDTO newComent = new ComentDTO();
            newComent.ComentId = comentFromDb.ComentId;
            newComent.ComentText = comentFromDb.ComentText;
            newComent.BlogId = comentFromDb.BlogId;
            newComent.Author = comentFromDb.Author;
            newComent.Postdate = comentFromDb.PostDate;

            return newComent;
        }

        public Coment ToComent() 
        {
            Coment newComent = new Coment();
            newComent.ComentId = this.ComentId;
            newComent.ComentText = this.ComentText;
            newComent.BlogId = this.BlogId;
            newComent.Author = this.Author;
            newComent.PostDate = this.Postdate;

            return newComent;
        }
    }
}